// Evol scripts.
// Author:
//    Reid
// Description:
//    Newbie guide for Artis.
// Variables:
//    ArtisQuests_Enora
// Values:
//    0    Default.
//    1    BlackSmith quest delivered.
//    2    Chelios Quest given.
//    3    Chelios Quest done.
//    4    BlackSmith gave the sword.
//    5    Light Armor Shop quest delivered.
//    6    Light Armor Shop gave the cloths.
//    7    Market quest delivered.
//    8    Q'Pid merchant.
//    9    Market gave the potion.
//    10   Hill quest delivered.
//    11   Fluffy killed.

001-1,176,113,0	script	Enora#001-1	NPC_HUMAN_FEMALE_NOOB,{

    function enora_don {
        speech 5,
            l("Don is renowned throughout the entire land of Aemil for his blacksmithing skills, and he is here, in Artis."),
            l("It's a great honor for us, at the Legion, to hold the security of his business!"),
            l("If you search for him you should look in the west of the city, it's the first house just after the left bridge, you can't miss it!"),
            l("Chelios, his apprentice, practices outside, mostly.");

        return;
    }

    function enora_legion {
        speech 5,
            l("The Legion of Gasaron are a group of warriors who vowed to protect and serve their neighbours."),
            l("We hold various training sessions, and also have a task board with a heap of things to do for the city and its surroundings."),
            l("It's a good place to earn money, it can also help you to travel throughout the land!"),
            l("Each big city hosts a Legion building, Artis' building is located in the north-west.");

        return;
    }

    function enora_light_armor {
        speech 5,
            l("The light armor shop is ran by Resa, she is part of the Merchant Guild of Artis."),
            l("She is very skilled when it comes to weaving an ordinary piece of cloth into a wonderful work of art!"),
            l("Her shop is on the west side of the city, between the Legion building and the library.");

        return;
    }

    function enora_market {
        speech 5,
            l("The market is located in the south-east of Artis, it is known as Merchant Guild's exhibit."),
            l("You need to be a member of the Merchant Guild to have a chance there."),
            l("And I bet you don't know who is in charge of monitoring the security of this place?");

        switch (select (l("The Legion?"), l("I don't know.")))
        {
            case 1:
                speech 5,
                    l("You hit the nail on the head, it's the Legion of Gasaron!"),
                    l("Our main responsibility in the city is to protect the Merchant Guild.");
                break;
            case 2:
                speech 5,
                    l("Cat got your tongue?"),
                    l("..."),
                    l("Your brain liquified to match the level of a piou! It's the Legion of Gasaron.");
                break;
        }
        return;
    }

    function enora_hill {
        speech 5,
            l("Go north from here until you find the dock warehouse, cross the bridge to the west side of the canal, continue north until you reach another bridge then cross it to the east side of the canal."),
            l("You should arrive at a park with a hill nearby.");

        return;
    }

    function enora_memories {
        speech 5,
            l("It's so exciting to meet somebody with amnesia!"),
            l("Can't you remember anything at all? Or do you have some memories of your past?"),
            l("What happens when you try to think about it?"),
            l("Does your mind go all fuzzy or does it feel like your head is going to explode??"),
            l("Try doing that now!");

        switch (select (l("Okay, but there won't be any explosions."),
                        lg("Don't get too excited about it...")))
        {
            case 1:
                narrator 5,
                    l("You concentrate and try to summon old memories from within your mind."),
                    l("You feel numb and everything around you looks foggy, but you can recall the feeling of the cold hard wood of your raft on a stormy night."),
                    l("A headache hits you and you lose your concentration.");

                speech 4,
                    l("So? You haven't exploded yet! Are you getting anything?");

                select (l("Not really. All I got was a headache..."));

                speech 5,
                    l("It's like your memories are locked away in your head! Cool!");

                break;
            case 2:
                mes "";
                break;
        }

        speech 4,
            l("Ok, sorry. Back to our fluffies.");

        return;
    }

    function enora_reward {
        .@exp_reward = getarg (0);
        .@zeny_reward = getarg (1);

        getexp .@exp_reward, 0;
        Zeny = Zeny + .@zeny_reward;

        narrator 4,
            l("You received @@ EXP and @@ E.", .@exp_reward, .@zeny_reward);

        return;
    }

    function enora_first_quest {
        speech 5,
            l("You probably don't have much business in this city as you don't remember who you are."),
            lg("So I was going to ask if maybe you would be interested in giving me a hand with a few errands.");

        switch (select (l("I guess so. What's in it for me?"),
                        l("Of course! What do you need?")))
        {
            case 1:
                speech 5,
                    l("Some tasks will help you become aquainted with Artis. Trust me.");
                break;
            case 2:
                mes "";
                break;
        }

        speech 4,
            l("I asked Don our blacksmith to prepare a black iron sword for morning, he should be done by now."),
            l("Go meet him, and take the package to me, it's an easy task."),
            l("You will be able to find Don's house in the west of the city, it's the first house just after the bridge on the left, you can't miss it!"),
            l("A young apprentice called Chelios might be waiting outside, speak to him, and return the package to me.");
            emotion E_HAPPY;

        setq ArtisQuests_Enora, 1;

        closedialog;
        goodbye;
        close;
    }

    function enora_second_quest {
        speech 5,
            l("Thank you for this commission, Chelios is as good as Don when it comes to forging metal."),
            l("By the way, did you ever talk with Don?"),
            l("If so, I hope that he didn't give you any hard time, sometimes he can get up on the wrong side of the bed he becomes an embittered and grumpy old man..."),
            l("Poor Chelios, I don't envy him..."),
            l("So, everything went fine?");

        switch (select (l("Chelios managed to do excellent work."),
                        l("The old man seemed to be senile.")))
        {
            case 1:
                speech 5, l("Fine, let's see his work...");
                narrator 4, l("Enora is carefully inspecting the sword.");
                speech 4,
                    l("Excellent!"),
                    l("The detail and craftsmanship that went into this sword can only be accomplished by the most practiced of blacksmiths.");

                break;
            case 2:
                speech 5,
                    l("He may not have all of his wits but keep in mind one thing:"),
                    l("Don is renowned throughout the entire land for his blacksmith skills, and he is here, in Artis."),
                    l("It's a great honor for us, at the Legion, to hold the security of his business!");

                break;
        }

        speech 4,
            l("After this small overview of Artis, what do you think of our city?"),
            l("The Legion of Gasaron is in charge of the security of the intramural part of our cities."),
            l("The control and administration of the cities passes hands sometimes. You may find the Mana Order or the Brotherhood in charge instead of us at some point!"),
            l("But we are quite lucky here, outside of some tipsy travelers there are no big problems around here, it's not like the capital, Esperia."),
            l("Now that I think about it, I have another task for you. I asked Resa from the light armor shop to craft me some new clothes, she is a bit far from here, I can't go there because I need to watch the dock."),
            l("Her shop is on the west side of the city, between the Legion building and the library.");

        setq ArtisQuests_Enora, 5;
        enora_reward (60, 100);

        closedialog;
        npctalk3 l("Thank you very much!");
        close;
    }

    function enora_third_quest {
        speech 5,
            l("Look how splendid this @@ is!", getitemlink (ArtisTankTop, CamelCottonDye)),
            l("It's nearly as good as one from Esperia, have you ever been there?"),
            l("Ah... Sorry, I forgot, again."),
            l("I mean, you forgot... Well."),
            l("If you ever find the time, pass by Esperia, it's the greatest city in all of Gasaron!"),
            l("You can find the building of the Legion of Gasaron there, like in any other city, but Esperia is important for us as our headquarters are there.");

        do
        {
            .@q = select (l("Do you still need help?"),
                          l("What is this \"legion\"?"));
            switch (.@q)
            {
                case 1:
                    break;
                case 2:
                    enora_legion;
                    break;
            }
        } while (.@q == 2);

        speech 5,
            l("Oh yes, I have one last errand for you, Q'Pid in the market sells potions."),
            l("It has been some days now since I asked her for a box of @@s, but she hasn't delivered anything yet.", getitemlink (PiberriesInfusion)),
            l("Please try to figure out what went wrong with this order and bring me those potions."),
            l("You will be able to find her in the market in the south-west of Artis.");

        setq ArtisQuests_Enora, 7;
        enora_reward (40, 125);

        closedialog;
        npctalk3 l("Thank you very much!");
        close;
    }

    function enora_fourth_quest {
        speech 5,
            l("Awesome!");

        speech 4,
            l("I have one more task for you. Trozz, another member of the Legion, sent me a letter earlier today."),
            l("Some citizens are worried about the growing number of Fluffies on the hill of Artis."),
            l("Children play there and can be badly hurt if they get too close to a Fluffy's nest."),
            l("It would have been easy for me to handle it but if you do it, you can earn some respect by killing Fluffies instead of their natural predators!"),
            l("Besides, I need to be here to watch out for thieves while La Johanne is docked."),
            l("You look confident. I will give you my old gear as reward and acknowledgment for your time... and take these potions as well!");

        set ArtisFluffyKilled, 0;

        inventoryplace TrainingGladius, 3;
        getitem TrainingGladius, 1;
        getitem2 ArtisTankTop, 1, 1, 0, 0, 5005, 0, 0, 0;
        getitem PiberriesInfusion, 5;
        setq ArtisQuests_Enora, 10;
        enora_reward (80, 175);

        speech 4,
            l("Do you know where the hill is?");

        switch (select (l("Yes I do."),
                        l("Please guide me.")))
        {
            case 1:
                speech 5,
                    l("Perfect! I will wait for you here.");
                break;
            case 2:
                speech 5,
                    l("Follow the up-stream and cross the canal twice using the two bridges north from here."),
                    l("The hill is located on the north-east of Artis.");
                break;
        }

        closedialog;
        npctalk3 l("Thank you very much!");
        close;
    }

    function enora_hill_cleaned {
        if (ArtisFluffyKilled < 9)
        {
            speech 5,
                l("Oh no, you still have @@ Fluffies to kill.", 10 - ArtisFluffyKilled);

            return;
        }
        else if (ArtisFluffyKilled < 10)
        {
            speech 5,
                l("Only one more Fluffy to kill and it's done!");

            return;
        }

        speech 5,
            l("I cannot find the words to express my gratitude for your hard work."),
            l("Keep the sword and the jacket, you deserved them!"),
            l("You now also have access to the Legion building. Good job, you earned it."),
            l("We hold various training sessions, and also have a task board with a heap of things to do for the city and its surroundings."),
            l("It's a very good place if you want to make some more money.");
            emotion E_WINK;

        if (getq (ArtisQuests_Enora) == 10)
        {
            setq ArtisQuests_Enora, 11;
            enora_reward (140, 500);
        }

        return;
    }

    function enora_quest_complete {
        switch (getq(ArtisQuests_Enora))
        {
            case 4:
                enora_second_quest;
                break;
            case 6:
                enora_third_quest;
                break;
            case 9:
                enora_fourth_quest;
                break;
            default:
                break;
        }

        return;
    }

    function enora_paid_potions {
        speech 5,
            lg("Are you sure that these are my potions?");

        if (askyesno() == ASK_YES)
        {
            delitem PiberriesInfusion, 5;
            enora_fourth_quest;
        }

        return;
    }

    if (getq(ArtisQuests_Enora) == 0)
    {
        speech 4,
            l("Hey! You must be @@.", strcharinfo(0)),
            lg("Julia told me how they found you in the sea, on a raft with a logo of..."),
            l("...I mean log! Made of log!"),
            l("I also heard you lost all your memories? That's a shame."),
            l("I'm sure you would have some interesting stories to tell!");
    }
    else
    {
        speech 4,
            l("Hey @@!", strcharinfo(0)),
            l("What brings you here today?");
    }

    do
    {
        .@q = getq(ArtisQuests_Enora);
        select
            rif(.@q == 0, l("She told me that you had some tasks for me.")),
            rif(.@q == 4 || .@q == 6 || .@q == 9, l("I have your package.")),
            rif(.@q == 8 && countitem(PiberriesInfusion) >= 5, l("I have your package.")),
            rif(.@q >= 10, l("I cleaned up the hill.")),
            rif(.@q >= 10, l("How many Fluffies did I kill on the hill?")),
            rif(.@q >= 1, l("Who is Don?")),
            rif(.@q >= 5, l("Where is the light armor shop?")),
            rif(.@q >= 7, l("Where is the market?")),
            rif(.@q >= 10, l("Where is the hill?")),
            rif(.@q >= 1, l("What is this \"legion\"?")),
            l("I wish I could remember something..."),
            rif(.@q != 0, l("Nothing."));

        switch (@menu)
        {
            case 1:
                enora_first_quest;
                break;
            case 2:
                enora_quest_complete;
                break;
            case 3:
                enora_paid_potions;
                break;
            case 4:
                enora_hill_cleaned;
                break;
            case 5:
                speech 5,
                    l("You killed @@ Fluffies.", ArtisFluffyKilled);
                if (ArtisFluffyKilled > 8)
                {
                    mesq l("If you continue there will be none left!");
                    next;
                }
                break;
            case 6:
                enora_don;
            case 7:
                enora_light_armor;
                break;
            case 8:
                enora_market;
                break;
            case 9:
                enora_hill;
                break;
            case 10:
                enora_legion;
                break;
            case 11:
                enora_memories;
                break;
            case 12:
                speech 5,
                    l("Please come back anytime!");
        }
    } while (@menu != 12);

    closedialog;
    goodbye;
    close;

OnInit:
    .sex = G_FEMALE;
    .distance = 5;
    end;
}

001-1,0,0,0	script	Mobs#001-1	NPC_HIDDEN,{
    end;

OnFluffyDeath:
    if (playerattached())
    {
        set ArtisFluffyKilled, ArtisFluffyKilled + 1;
    }
    end;
}
